package com.atguigu.cms.controller;

import com.atguigu.cms.entity.CrmBanner;
import com.atguigu.cms.service.CrmBannerService;
import com.atguigu.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author admin
 * @since 2020-07-11
 */
@RestController
@RequestMapping("/cms/crmBannerUser")
@Api(description = "BannerCrm接口-8004 前台获取banner")
@CrossOrigin
public class CrmBannerUserController {

    @Autowired
    CrmBannerService crmBannerService;

    @ApiOperation(value = "获取banner数据")
    @GetMapping("/getBanner")
    public R getBanner() {
        List<CrmBanner> list = crmBannerService.selectBanner();
        return R.ok().data("bannerItems", list);
    }
}

